#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "../umlcore/PartialElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class GeneralOrdering;
class Interaction;
class InteractionOperand;
class Lifeline;

/// <summary>
/// InteractionFragment
/// InteractionFragment is an abstract notion of the most general interaction unit.
/// An InteractionFragment is a piece of an Interaction. Each InteractionFragment is
/// conceptually like an Interaction by itself.
/// </summary>
class UMLMODEL_EXPORT InteractionFragment : public PartialElement {

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// covereds getter
    /// References the Lifelines that the InteractionFragment involves.
    /// </summary>
    vector<shared_ptr<Lifeline>>& covereds();

    /// <summary>
    /// enclosingInteraction getter
    /// The Interaction enclosing this InteractionFragment.
    /// </summary>
    shared_ptr<Interaction> enclosingInteraction() const;

    /// <summary>
    /// enclosingInteraction setter
    /// The Interaction enclosing this InteractionFragment.
    /// </summary>
    void setEnclosingInteraction(shared_ptr<Interaction> value);

    /// <summary>
    /// enclosingOperand getter
    /// The operand enclosing this InteractionFragment (they may nest recursively).
    /// </summary>
    shared_ptr<InteractionOperand> enclosingOperand() const;

    /// <summary>
    /// enclosingOperand setter
    /// The operand enclosing this InteractionFragment (they may nest recursively).
    /// </summary>
    void setEnclosingOperand(shared_ptr<InteractionOperand> value);

    /// <summary>
    /// generalOrderings getter
    /// The general ordering relationships contained in this fragment.
    /// </summary>
    vector<shared_ptr<GeneralOrdering>>& generalOrderings();

private: // Fields
    /// <summary>
    /// covereds
    /// References the Lifelines that the InteractionFragment involves.
    /// </summary>
    vector<shared_ptr<Lifeline>> covereds_;

    /// <summary>
    /// enclosingInteraction
    /// The Interaction enclosing this InteractionFragment.
    /// </summary>
    shared_ptr<Interaction> enclosingInteraction_;

    /// <summary>
    /// enclosingOperand
    /// The operand enclosing this InteractionFragment (they may nest recursively).
    /// </summary>
    shared_ptr<InteractionOperand> enclosingOperand_;

    /// <summary>
    /// generalOrderings
    /// The general ordering relationships contained in this fragment.
    /// </summary>
    vector<shared_ptr<GeneralOrdering>> generalOrderings_;

};

} // namespace uml
